#!/usr/bin/python
# -*- coding: UTF-8 -*-
import pymysql
# 打开数据库连接
db = pymysql.connect(host="172.31.11.63", port=3306, user="djangotest", password="P52koMfruQGpWG226XqxLf3J", db="djangotest")

# 使用cursor()方法获取操作游标
cursor = db.cursor()

# sql 删除语句
sql = "delete from EMPLOYEE where AGE > %s" %(20)

try:
    # 执行sql语句
    cursor.execute(sql)
    # 提交修改
    db.commit()
except:
    # 发生错误时回滚
    db.rollback()

# 关闭连接
db.close()